package com.example.big_event.mapper;


import com.example.big_event.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper//声明这是一个mapper接口
public interface UerMapper {
    //根据用户名查找用户
    @Select("select * from user where username = #{username}")
    User findByuserUserName(String username);
    
    //添加用户
    @Insert("insert into user (username,password,create_time,update_time) values(#{username},#{password},now(),now())")
    void add(String username, String password);


    @Update("update user set nickname = #{nickname},email = #{email},user_pic = #{uer_Pic},update_time = #{updateTime}" +
            " where id = #{id}")
    void update(User user);

    @Update("update user set user_pic = #{avartarurl},update_time = now() where id = #{id}")
    void updateavartar(String avartarurl, Integer id);

    @Update("update user set update_time = now(),password = #{md5String} where  id = #{id}")
    void updatepassword(String md5String, Integer id);
}
